﻿using System;
using System.Collections;
using System.Collections.Generic;
namespace Library.Winform.Draw {
  internal class CollectionBase<T> : ICollection<T> {
    internal CollectionBase() {
      InnerList = new LinkedList<T>();
    }
    protected readonly LinkedList<T> InnerList;
    public IEnumerator<T> GetEnumerator() {
      return InnerList.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator() {
      return GetEnumerator();
    }

    public virtual void Add(T item) {
      InnerList.AddLast(item);
    }

    public virtual void Clear() {
      InnerList.Clear();
    }

    public bool Contains(T item) {
      return InnerList.Contains(item);
    }

    public void CopyTo(T[] array, int arrayIndex) {
      InnerList.CopyTo(array, arrayIndex);
    }

    public bool Remove(T item) {
      return InnerList.Remove(item);
    }

    public int Count {
      get { return InnerList.Count; }
    }

    public bool IsReadOnly {
      get { return false; }
    }
  }
}
